#!/bin/bash
LEN=`ps aux | grep queue:work | wc -l`
LEN=`expr $LEN - 1`
if [ $LEN = 0 ]; then
    echo 'no process found'
    exit 0
fi

echo ${LEN} 'process(es) found. trying to stop...'
ps aux | grep queue:work | sed 's/\s\+/ /g' | head -n $LEN | cut -d' ' -f2 | xargs kill
